*Set working directory to folder with dataset
*cd "/Users/jackpaine/Dropbox/Current papers/ColonialBook"


**********************************************
***Calculations reported throughout article***
**********************************************
***Number of countries in dataset
use dataset.dta, clear
keep if ht_region==5 & year<=1969
keep if pcrev!=.
keep cname
duplicates drop
gen one=1
summarize one
sort cname
list cname
use dataset.dta, clear
keep if ht_region!=5 & year<=1969
keep if pcrev!=.
keep cname
duplicates drop
gen one=1
summarize one
sort cname
list cname
use dataset.dta, clear
keep if ht_region==5 & year<1900
keep if pcrev!=.
keep cname
duplicates drop
gen one=1
summarize one
sort cname
list cname
use dataset.dta, clear
keep if ht_region!=5 & year<1900
keep if pcrev!=.
keep cname
duplicates drop
gen one=1
summarize one
sort cname
list cname

***Comparisons to accompany Figure 1
use dataset.dta, clear
gen west=0
replace west=1 if ht_region==5
replace west=. if cname=="Japan"
sort pcrev
*1913
list cname pcrev if pcrev!=. & year==1913
summarize pcrev if west==1 & year==1913
summarize pcrev if west==0 & year==1913
gen africa=0
replace africa=1 if ht_region==4
replace africa=1 if cname=="Morocco"
replace africa=1 if cname=="Tunisia"
replace africa=1 if cname=="Algeria"
replace africa=1 if cname=="Libya"
replace africa=1 if cname=="Egypt"
summarize pcrev if africa==1 & year==1913
*1969
gen lamerica=0
replace lamerica=1 if ht_region==2
replace lamerica=1 if ht_region==10
gen asia=0
replace asia=1 if ht_region>=6 & ht_region<=8
replace asia=. if cname=="Japan"
replace asia=1 if ht_region==3 & africa!=1
summarize pcrev if west==1 & year==1913
summarize pcrev if west==1 & year==1969
summarize pcrev if west==0 & year==1913
summarize pcrev if west==0 & year==1969
summarize pcrev if lamerica==1 & year==1913
summarize pcrev if lamerica==1 & year==1969
summarize pcrev if africa==1 & year==1913
summarize pcrev if africa==1 & year==1969
summarize pcrev if asia==1 & year==1913
summarize pcrev if asia==1 & year==1969
summarize pcrev if west==1 & year==1969
summarize pcrev if west==0 & year==1969
list cname pcrev if pcrev!=. & year==1969
*Tax/GDP comparisons
summarize centaxgdp if west==1 & year==1913
summarize centaxgdp if west==1 & year==1969
summarize centaxgdp if lamerica==1 & year==1913
summarize centaxgdp if lamerica==1 & year==1969
*Missingness in other datasets
summarize pcrev if year<=1969
summarize centaxgdp if year<=1969
summarize taxgdp if year<=1969
summarize normrev if year<=1969
summarize centaxgdp if year<=1969 & west==0
summarize taxgdp if year<=1969 & west==0

***Western Europe vs. India in 1969
use dataset.dta, clear
gen west=0
replace west=1 if ht_region==5
summarize pcrev if west==1 & year==1969
summarize pcrev if cname=="India" & year==1969

***Customs as percentage of U.S. revenues
use dataset.dta, clear
summarize pcustoms if cname=="United States" & year<1900

***Western Europe vs. Southern Cone over 1900-13
use dataset.dta, clear
gen west=0
replace west=1 if cname=="United Kingdom"
replace west=2 if ht_region==5 & cname!="United Kingdom"
replace west=3 if cname=="Argentina"
replace west=3 if cname=="Chile"
replace west=3 if cname=="Uruguay"
gen period=0
replace period=1 if year>=1900 & year<1914
egen pcrev_west=mean(pcrev), by(west period)
egen centaxgdp_west=mean(centaxgdp), by(west period)
summarize pcrev_west if west==1 & period==1
summarize pcrev_west if west==2 & period==1
summarize pcrev_west if west==3 & period==1
summarize centaxgdp_west if west==1 & period==1
summarize centaxgdp_west if west==2 & period==1
summarize centaxgdp_west if west==3 & period==1
summarize pcustoms if cname=="Chile" & year>=1900 & year<1914

***Western Europe vs. plantation colonies
use dataset.dta, clear
gen period=0
replace period=1 if year>=1900 & year<1914
gen west=0
replace west=1 if cname=="United Kingdom"
replace west=2 if ht_region==5 & cname!="United Kingdom"
replace west=3 if cname=="Barbados"
replace west=3 if cname=="Cuba"
replace west=3 if cname=="Fiji"
replace west=3 if cname=="Guyana"
replace west=3 if cname=="Jamaica"
replace west=3 if cname=="Malaysia"
replace west=3 if cname=="Mauritius"
replace west=3 if cname=="Trinidad and Tobago"
egen pcrev_west=mean(pcrev), by(west period)
egen normrev_west=mean(normrev), by(west period)
summarize pcrev_west if west==1 & period==1
summarize pcrev_west if west==2 & period==1
summarize pcrev_west if west==3 & period==1
summarize normrev_west if west==1 & period==1
summarize normrev_west if west==2 & period==1
summarize normrev_west if west==3 & period==1

***Western Europe vs. occupation colonies
use dataset.dta, clear
gen occupation=0
replace occupation=1 if cname=="Algeria"
replace occupation=1 if cname=="Benin"
replace occupation=1 if cname=="Cameroon"
replace occupation=1 if cname=="Cyprus"
replace occupation=1 if cname=="Ghana"
replace occupation=1 if cname=="Guinea"
replace occupation=1 if cname=="India"
replace occupation=1 if cname=="Indonesia"
replace occupation=1 if cname=="Ivory Coast"
replace occupation=1 if cname=="Madagascar"
replace occupation=1 if cname=="Malawi"
replace occupation=1 if cname=="Niger"
replace occupation=1 if cname=="Nigeria"
replace occupation=1 if cname=="Senegal"
replace occupation=1 if cname=="Sri Lanka"
replace occupation=1 if cname=="Tanzania"
replace occupation=1 if cname=="Togo"
replace occupation=1 if cname=="Uganda"
replace occupation=1 if cname=="Zambia"
replace occupation=1 if cname=="Zimbabwe"
summarize pcrev if cname=="United Kingdom" & year>=1900 & year<=1913
summarize pcrev if ht_region==5 & cname!="United Kingdom" & year>=1900 & year<=1913
summarize pcrev if occupation==1 & year>=1900 & year<=1913
summarize normrev if cname=="United Kingdom" & year>=1900 & year<=1913
summarize normrev if ht_region==5 & cname!="United Kingdom" & year>=1900 & year<=1913
summarize normrev if occupation==1 & year>=1900 & year<=1913
gen gdpdata=0
replace gdpdata=1 if cname=="India"
replace gdpdata=1 if cname=="Indonesia"
replace gdpdata=1 if cname=="Sri Lanka"
summarize pcrev if gdpdata==1 & year>=1900 & year<=1913

***Western Europe vs. other empires
*Japan
use dataset.dta, clear
summarize pcrev if cname=="Japan" & year==1913
summarize pcrev if ht_region==5 & year==1913
summarize centaxgdp if cname=="Japan" & year==1913
summarize centaxgdp if ht_region==5 & year==1913
summarize taxgdp if cname=="Japan" & year==1913
summarize taxgdp if ht_region==5 & year==1913
summarize normrev if cname=="Japan" & year==1913
summarize normrev if ht_region==5 & year==1913
*Russia
summarize pcrev if cname=="Russia" & year==1815
summarize pcrev if cname=="United Kingdom" & year==1815
summarize pcrev if cname=="France" & year==1815
summarize pcrev if cname=="Russia" & year==1913
summarize pcrev if cname=="United Kingdom" & year==1913
summarize pcrev if ht_region==5 & cname!="United Kingdom" & year==1913
*Egypt
gen west=0
replace west=1 if ht_region==5
summarize pcrev if west==1 & year>=1870 & year<1880
summarize pcrev if cname=="Egypt" & year>=1870 & year<1880
summarize normrev if west==1 & year==1870
summarize normrev if cname=="Egypt" & year==1870

***Western Europe income vs. customs
use dataset.dta, clear
sort ccode year
gen category_share=.
replace category_share=1 if ccodecow==2
replace category_share=1 if ccodecow==20
replace category_share=1 if ccodecow==900
replace category_share=1 if ccodecow==920
replace category_share=2 if ht_region==5 & category_share!=1
replace pcustoms=pcustoms/100
replace pincome=pincome/100
summarize pcustoms if category_share==1 & year==1969
summarize pcustoms if category_share==2 & year==1969
summarize pincome if category_share==1 & year==1969
summarize pincome if category_share==2 & year==1969

***Non-Western customs and income
use dataset.dta, clear
gen west=0
replace west=1 if ht_region==5
replace west=. if cname=="Japan"
summarize pcustoms pincome if year==1969 & west==0
summarize pincome if year==1969 & cname=="South Africa"
summarize pincome if year==1969 & cname=="India"
summarize pincome if year==1969 & cname=="Egypt"
summarize pincome if year==1969 & cname=="Japan"
summarize pcrev if year==1964 & cname=="Taiwan"
summarize pcrev if year==1964 & ht_region!=5
summarize pcrev if year==1969 & cname=="Taiwan"
summarize pcrev if year==1969 & ht_region!=5
summarize pincome if year==1969 & cname=="Korea, South"

***More GDP comparisons (Appendix A.1)
use dataset.dta, clear
gen west=0
replace west=1 if ht_region==5
replace west=. if cname=="Japan"
replace west=. if cname=="Russia"
summarize taxgdp if west==1 & year==1913
summarize taxgdp if west==0 & year==1913
summarize normrev if west==1 & year==1913
summarize normrev if west==0 & year==1913
summarize taxgdp if west==1 & year==1969
summarize taxgdp if west==0 & year==1969
summarize normrev if west==1 & year==1969
summarize normrev if west==0 & year==1969

***Intra-British empire (Appendix A.2)
use dataset.dta, clear
summarize pcrev if cname=="United Kingdom" & year==1913
summarize pcrev if cname=="Jamaica" & year==1913
summarize pcrev if cname=="United Kingdom" & year==1968
summarize pcrev if cname=="Jamaica" & year==1968
summarize normrev if cname=="United Kingdom" & year==1913
summarize normrev if cname=="Jamaica" & year==1913
summarize normrev if cname=="United Kingdom" & year==1968
summarize normrev if cname=="Jamaica" & year==1968


********************************************
***Figure 1: The Great Revenue Divergence***
********************************************
use dataset.dta, clear
gen west=0
replace west=1 if ht_region==5
replace west=. if cname=="Japan"
egen pcrev_west=mean(pcrev), by(west year)
egen andersson_west=mean(centaxgdp), by(west year)
replace andersson_west=andersson_west/100
replace sample_region=0 if cname=="United States"
replace sample_region=0 if cname=="Japan"
sort ccode year
*Panel A
graph twoway (line pcrev_west year if west==1 & sample_region==1 & year>=1850 & year<=1969, lcolor(black) lpattern(solid)) ///
(line pcrev_west year if west==0 & sample_region==1 & year>=1850 & year<=1969, lcolor(black) lpattern(dash)), ///
xlabel(1850(25)1950 1969) scheme(s2mono) graphregion(fcolor(white)) ///
legend(order(1 "West" 2 "Non-Western")) ///
ytitle("Revenue per capita",size(medlarge)) xtitle("") title("A. Revenue per capita") name(panela, replace) nodraw
*Panel B
graph twoway (line andersson_west year if west==1 & sample_region==1 & year>=1850 & year<=1969, lcolor(black) lpattern(solid)) ///
(line andersson_west year if west==0 & sample_region==1 & year>=1850 & year<=1969, lcolor(black) lpattern(dash)), ///
xlabel(1850(25)1950 1969) scheme(s2mono) graphregion(fcolor(white)) ytitle("Taxes/GDP",size(medium)) xtitle("") ///
legend(order(1 "West" 2 "South America")) title("B. Taxes/GDP") name(panelb, replace) nodraw ylabel(0(.05).2)
graph combine panela panelb, cols(1) xsize(1) ysize(1.5) graphregion(color(white))
graph2tex, epsfile(figure1)


*******************************************************
***Figure 2: Comparing Income and Revenue Divergence***
*******************************************************
use dataset.dta, clear
sort ccode year
gen west=0
replace west=1 if ht_region==5
replace west=. if cname=="Japan"
gen GDP_west=.
gen GDP_nonwest=.
gen pcrev_west=.
gen pcrev_nonwest=.
foreach i of numlist 1880/1969 {
	summarize madd if west==1 & year==`i' & pcrev!=.
	replace GDP_west=r(mean) if year==`i'
	summarize madd if west==0 & year==`i' & pcrev!=.
	replace GDP_nonwest=r(mean) if year==`i'
	summarize pcrev if west==1 & year==`i' & madd!=.
	replace pcrev_west=r(mean) if year==`i'
	summarize pcrev if west==0 & year==`i'& madd!=.
	replace pcrev_nonwest=r(mean) if year==`i'
    }
gen GDP_ratio=GDP_west/GDP_nonwest
gen pcrev_ratio=pcrev_west/pcrev_nonwest
graph twoway (line pcrev_ratio year if cname=="United Kingdom" & year>=1880 & year<=1969, lcolor(black) lpattern(solid)) ///
(line GDP_ratio year if cname=="United Kingdom" & year>=1880 & year<=1969, lcolor(black) lpattern(dash)), ///
ylabel(0(2)8,labsize(medlarge)) xlabel(1880(20)1940 1969,labsize(medlarge)) scheme(s2mono) graphregion(fcolor(white)) xtitle("") ///
legend(order(1 "Revenues ratio" 2 "GDP ratio"))
graph2tex, epsfile(figure2)


*************************************************
***Figure 3: Hypothetical Revenue Trajectories***
*************************************************
use dynamic_rev.dta, clear
graph twoway (scatter revenue period if leg==0, mcolor(black) msymbol(O)) ///
(lfit revenue period if leg==0, lcolor(black) lpattern(dash)) /// 
(scatter revenue period if leg==1, mcolor(black) msymbol(O)) ///
(lfit revenue period if leg==1, lcolor(black) lpattern(solid)), ///
xlabel(1 2,labsize(large)) ylabel(0(.2)1.2,labsize(large)) legend(off) ///
xtitle("Period",size(large)) ytitle("Equilibrium revenue intake",size(large))
graph2tex, epsfile(figure3)


**********************************************
***Figure 4: Western Revenue Intake Pre-WWI***
**********************************************
use dataset.dta, clear
sort ccode year
gen othereurope=0
replace othereurope=1 if ht_region==5 & cname!="United Kingdom" & cname!="France" & cname!="United States" & cname!="New Zealand"
egen pcrev_othereurope=mean(pcrev), by(othereurope year)
egen centaxgdp_othereurope=mean(centaxgdp), by(othereurope year)
replace centaxgdp=centaxgdp/100
replace centaxgdp_othereurope=centaxgdp_othereurope/100
*Panel A
graph twoway (line pcrev year if cname=="United Kingdom" & year>=1800 & year<1914, lcolor(black) lpattern(solid)) ///
(line pcrev year if cname=="United States" & year>=1800 & year<1914, lcolor(black) lpattern(dash)) ///
(line pcrev year if cname=="France" & year>=1800 & year<1914, lcolor(blue) lpattern(solid)) ///
(line pcrev_othereurope year if othereurope==1 & year>=1800 & year<1914, sort lcolor(blue) lpattern(dash)), ///
xlabel(1800(25)1900 1913,labsize(medlarge)) ylabel(,labsize(medlarge)) scheme(s2mono) graphregion(fcolor(white)) ///
ytitle("Revenue per capita",size(large)) xtitle("") title("A. Revenue per capita",size(vlarge)) ///
xline(1809.5, lwidth(14) lc(gs14)) xline(1867, lwidth(10) lc(gs14)) name(panela, replace) nodraw
*Panel B
graph twoway (line centaxgdp year if cname=="United Kingdom" & year>=1800 & year<1914, lcolor(black) lpattern(solid)) ///
(line centaxgdp year if cname=="United States" & year>=1800 & year<1914, lcolor(black) lpattern(dash)) ///
(line centaxgdp year if cname=="France" & year>=1800 & year<1914, lcolor(blue) lpattern(solid)) ///
(line centaxgdp_othereurope year if othereurope==1 & year>=1800 & year<1914, sort lcolor(blue) lpattern(dash)), ///
xlabel(1800(25)1900 1913,labsize(medlarge)) ylabel(,labsize(medlarge)) scheme(s2mono) graphregion(fcolor(white)) legend(order(1 "Britain" 2 "United States" 3 "France" 4 "Other Western"))  ///
ytitle("Taxes/GDP",size(large)) xtitle("") title("B. Taxes/GDP",size(vlarge)) xline(1809.5, lwidth(14) lc(gs14)) xline(1867, lwidth(10) lc(gs14)) ///
name(panelb, replace) nodraw
*Combine
grc1leg panela panelb, graphregion(color(white)) legendfrom(panelb) name(panelc, replace)
graph combine panelc, cols(1) xsize(2) ysize(1) graphregion(color(white))
graph2tex, epsfile(figure4)


**************************************************
***Figure 5: Comparative Revenue Intake Pre-WWI***
**************************************************
use dataset.dta, clear
sort ccode year
gen colony_new=.
replace colony_new=0 if ht_region==5 & cname!="United Kingdom"
replace colony_new=1 if ht_region==4
replace colony_new=1 if cname=="Algeria"
replace colony_new=1 if cname=="Cyprus"
replace colony_new=1 if cname=="India"
replace colony_new=1 if cname=="Indonesia"
replace colony_new=1 if cname=="Sri Lanka"
replace colony_new=1 if cname=="Ghana"
replace colony_new=1 if cname=="Malawi"
replace colony_new=1 if cname=="Zambia"
replace colony_new=1 if cname=="Zimbabwe"
replace colony_new=1 if cname=="Senegal"
replace colony_new=1 if cname=="Benin"
replace colony_new=1 if cname=="Niger"
replace colony_new=1 if cname=="Cote d'Ivoire"
replace colony_new=1 if cname=="Guinea"
replace colony_new=1 if cname=="Togo"
replace colony_new=1 if cname=="Cameroon"
replace colony_new=1 if cname=="Nigeria"
replace colony_new=1 if cname=="Uganda"
replace colony_new=1 if cname=="Kenya"
replace colony_new=1 if cname=="Tanzania"
replace colony_new=1 if cname=="Madagascar"
replace colony_new=2 if cname=="Barbados"
replace colony_new=2 if cname=="Cuba"
replace colony_new=2 if cname=="Fiji"
replace colony_new=2 if cname=="Guyana"
replace colony_new=2 if cname=="Jamaica"
replace colony_new=2 if cname=="Malaysia"
replace colony_new=2 if cname=="Mauritius"
replace colony_new=2 if cname=="Trinidad and Tobago"
replace colony_new=3 if cname=="Chile"
replace colony_new=3 if cname=="Argentina"
replace colony_new=3 if cname=="Uruguay"
replace colony_new=4 if cname=="United Kingdom"
replace colony_new=5 if cname=="Japan"
replace colony_new=5 if cname=="Russia"
replace colony_new=5 if cname=="Egypt"
egen pcrev_colony_new=mean(pcrev), by(colony_new year)
egen normrev_colony_new=mean(normrev), by(colony_new year)
gen early20th=0
replace early20th=1 if year>=1900 & year<=1913
egen pcrev_colony_early20th=mean(pcrev), by(colony_new early20th)
egen normrev_colony_early20th=mean(normrev), by(colony_new early20th)
sort ccode year
*Panel A
graph twoway (line pcrev year if cname=="Chile" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Argentina" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Uruguay" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="United Kingdom" & year>=1800 & year<1914, lcolor(black) lpattern(solid)) ///
(line pcrev_colony_new year if colony_new==0 & year>=1800 & year<1914, sort lcolor(blue) lpattern(solid)) ///
(line pcrev_colony_new year if colony_new==3 & year>=1800 & year<1914, sort lcolor(gray) lpattern(solid) lwidth(medthick)), ///
xlabel(1800(25)1900 1913) ylabel(0(25)125,labsize(small)) scheme(s2mono) graphregion(fcolor(white)) ///
legend(order(4 "Britain" 5 "Other Western" 6 "Average non-Western" 1 "Individual non-Western") size(small)) ///
ytitle("Revenue per capita",size(medium)) xtitle("") title("A. Southern Cone",size(medlarge)) name(panela, replace) nodraw
*Panel B
graph twoway (line pcrev year if cname=="Cuba" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Fiji" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Guyana" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Jamaica" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Malaysia" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Mauritius" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Trinidad and Tobago" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="United Kingdom" & year>=1800 & year<1914, lcolor(black) lpattern(solid)) ///
(line pcrev_colony_new year if colony_new==0 & year>=1800 & year<1914, sort lcolor(blue) lpattern(solid)) ///
(line pcrev_colony_new year if colony_new==2 & year>=1800 & year<1914, sort lcolor(gray) lpattern(solid) lwidth(medthick)), ///
xlabel(1800(25)1900 1913) scheme(s2mono) graphregion(fcolor(white)) legend(off) ///
ytitle("Revenue per capita",size(medium)) xtitle("") title("B. Plantation colonies",size(medlarge)) name(panelb, replace) nodraw
*Panel C
graph twoway (line pcrev year if cname=="Algeria" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Cyprus" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Ghana" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="India" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Indonesia" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Malawi" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Sri Lanka" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Zambia" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Senegal" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Benin" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Niger" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Cote d'Ivoire" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Guinea" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Togo" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Cameroon" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Nigeria" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Uganda" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Kenya" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Tanzania" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Madagascar" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Zimbabwe" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="United Kingdom" & year>=1800 & year<1914, lcolor(black) lpattern(solid)) ///
(line pcrev_colony_new year if colony_new==0 & year>=1800 & year<1914, sort lcolor(blue) lpattern(solid)) ///
(line pcrev_colony_new year if colony_new==1 & year>=1800 & year<1914, sort lcolor(gray) lpattern(solid) lwidth(medthick)), ///
xlabel(1800(25)1900 1913) scheme(s2mono) graphregion(fcolor(white)) legend(off) ///
ytitle("Revenue per capita",size(medium)) xtitle("") title("C. Occupation colonies",size(medlarge)) name(panelc, replace) nodraw
*Panel D
graph twoway (line pcrev year if cname=="Russia" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Japan" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="Egypt" & year>=1800 & year<1914, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
(line pcrev year if cname=="United Kingdom" & year>=1800 & year<1914, lcolor(black) lpattern(solid)) ///
(line pcrev_colony_new year if colony_new==0 & year>=1800 & year<1914, sort lcolor(blue) lpattern(solid)) ///
(line pcrev_colony_new year if colony_new==5 & year>=1800 & year<1914, sort lcolor(gray) lpattern(solid) lwidth(medthick)), ///
xlabel(1800(25)1900 1913) scheme(s2mono) graphregion(fcolor(white)) legend(off) ///
ytitle("Revenue per capita",size(medium)) xtitle("") title("D. Non-Western empires",size(medlarge)) name(paneld, replace) nodraw
*Combine
grc1leg panela panelb panelc paneld, graphregion(color(white)) legendfrom(panela) name(panele, replace)
graph combine panele, cols(2) xsize(3) ysize(2) graphregion(color(white))
graph2tex, epsfile(figure5)


*********************************************************************
***Figure 6: Sources of Western Revenues: Customs and Income Taxes***
*********************************************************************
use dataset.dta, clear
sort ccode year
gen category_share=.
replace category_share=1 if ccodecow==2
replace category_share=1 if ccodecow==20
replace category_share=1 if ccodecow==900
replace category_share=1 if ccodecow==920
replace category_share=2 if ht_region==5 & category_share!=1
replace pcustoms=pcustoms/100
replace pincome=pincome/100
egen pcustoms_category=mean(pcustoms), by(category_share year)
egen pincome_category=mean(pincome), by(category_share year)
*Panel A
graph twoway (line pcustoms_category year if category_share==1 & year>=1850 & year<=1969, sort lcolor(black) lpattern(solid)) ///
(line pcustoms_category year if category_share==2 & year>=1850 & year<=1969, sort lcolor(black) lpattern(dash)), ///
xlabel(1850(25)1950 1969,labsize(medlarge)) ylabel(0(.2)1,labsize(medlarge)) scheme(s2mono) graphregion(fcolor(white)) legend(off) ///
ytitle("Customs taxes/all taxes",size(large)) xtitle("") title("A. Customs taxes",size(vlarge)) name(panela, replace) nodraw
*Panel B
graph twoway (line pincome_category year if category_share==1 & year>=1850 & year<=1969, sort lcolor(black) lpattern(solid)) ///
(line pincome_category year if category_share==2 & year>=1850 & year<=1969, sort lcolor(black) lpattern(dash)), ///
xlabel(1850(25)1950 1969,labsize(medlarge)) ylabel(0(.2)1,labsize(medlarge)) scheme(s2mono) graphregion(fcolor(white)) ///
legend(order(1 "Western offshoots" 2 "Western Europe")) ///
ytitle("Income taxes/all taxes",size(large)) xtitle("") title("B. Income taxes",size(vlarge)) name(panelb, replace) nodraw
grc1leg panela panelb, graphregion(color(white)) legendfrom(panelb) name(panelc, replace)
graph combine panelc, cols(2) xsize(2) ysize(1) graphregion(color(white))
graph2tex, epsfile(figure6)


***********************************************************
***Figure A.1: Revenues Per Capita by Country, 1850–1969***
***********************************************************
use dataset.dta, clear
replace cname="Central African Rep." if cname=="Central African Republic"
replace cname="Dem. Rep. of Congo" if cname=="Democratic Republic of Congo"
keep if year<=1969
keep if year>=1850
gen one=1
replace one=. if pcrev==.
egen test=total(one), by(cname)
drop if test==0
sort cname
gen num=_n
drop if num>4396
sort ccode year
xtset ccode year
xtline pcrev, tlabel(1850(50)1950) scheme(s2mono) graphregion(fcolor(white)) ytitle("") xtitle("") ///
title("") byopts(col(6) ix noiy noiyt noiyl) ysize(5) i(cname) t(year) recast(line) cmissing(n) legend(off)
graph2tex,  epsfile(figurea1_part1)
use dataset.dta, clear
replace cname="Central African Rep." if cname=="Central African Republic"
replace cname="Dem. Rep. of Congo" if cname=="Democratic Republic of Congo"
keep if year<=1969
keep if year>=1850
gen one=1
replace one=. if pcrev==.
egen test=total(one), by(cname)
drop if test==0
sort cname
gen num=_n
drop if num<=4396
sort ccode year
xtset ccode year
xtline pcrev, tlabel(1850(50)1950) scheme(s2mono) graphregion(fcolor(white)) ytitle("") xtitle("") ///
title("") byopts(col(6) ix noiy noiyt noiyl) ysize(7) i(cname) t(year) recast(line) cmissing(n) legend(off)
graph2tex,  epsfile(figurea1_part2)


****************************************************************************
***Figure A.2: Alternative Measures: Accounting for Differences in Income***
****************************************************************************
use dataset.dta, clear
gen west=0
replace west=1 if ht_region==5
replace west=. if cname=="Japan"
replace west=. if cname=="Russia"
egen beramendi_west=mean(taxgdp) if taxgdp!=., by(west year)
egen maddison_west=mean(normrev) if normrev!=., by(west year)
replace sample_region=0 if cname=="United States"
replace sample_region=0 if cname=="Japan"
*Panel A
graph twoway (line beramendi_west year if west==1 & sample_region==1 & year>=1850 & year<=1969, lcolor(black) lpattern(solid)) ///
(line beramendi_west year if west==0 & sample_region==1 & year>=1850 & year<=1969, lcolor(black) lpattern(dash)), ///
xlabel(1850(25)1950 1969) ylabel(0(.1).3) scheme(s2mono) graphregion(fcolor(white)) ///
ytitle("Taxes/GDP",size(medium)) xtitle("") title("A. Tax/GDP (Beramendi et al.)",size(medlarge)) ///
name(panela, replace) nodraw legend(off)
*Panel B
graph twoway (line maddison_west year if west==1 & sample_region==1 & year>=1850 & year<=1969, lcolor(black) lpattern(solid)) ///
(line maddison_west year if west==0 & sample_region==1 & year>=1850 & year<=1969, lcolor(black) lpattern(dash)), ///
xlabel(1850(25)1950 1969) scheme(s2mono) graphregion(fcolor(white)) ///
legend(order(1 "West" 2 "Non-Western")) ///
ytitle("Normalized revenue",size(medium)) xtitle("") title("B. Normalized revenue",size(medlarge)) ///
name(panelb, replace) nodraw legend(order(1 "West" 2 "Non-Western"))
graph combine panela panelb, cols(1) xsize(1) ysize(1.5) graphregion(color(white))
graph2tex, epsfile(figurea2)


*******************************************
***Figure A.3: Within-Empire Comparisons***
*******************************************
use dataset.dta, clear
sort ccode year
*Panel A
graph twoway (line pcrev year if cname=="United Kingdom" & year>=1850 & year<=1969, lcolor(black) lpattern(solid)) ///
(line pcrev year if cname=="New Zealand" & year>=1850 & year<=1969, lcolor(black) lpattern(dash)) ///
(line pcrev year if cname=="India" & year>=1850 & year<=1969, lcolor(blue) lpattern(solid)) ///
(line pcrev year if cname=="Jamaica" & year>=1850 & year<=1969, lcolor(blue) lpattern(dash)) ///
(line pcrev year if cname=="Ghana" & year>=1850 & year<=1969, lcolor(gray) lpattern(solid)), ///
xlabel(1850(25)1950 1969) scheme(s2mono) graphregion(fcolor(white)) ///
legend(order(1 "Britain" 2 "New Zealand" 3 "India" 4 "Jamaica" 5 "Ghana")) ///
ytitle("Revenue per capita",size(medlarge)) xtitle("") name(panela, replace) nodraw ///
title("A. British Empire")
*Panel B
graph twoway (line pcrev year if cname=="France" & year>=1850 & year<=1969, lcolor(black) lpattern(solid)) ///
(line pcrev year if cname=="Algeria" & year>=1850 & year<=1969, lcolor(blue) lpattern(solid)) ///
(line pcrev year if cname=="Madagascar" & year>=1850 & year<=1969, lcolor(blue) lpattern(dash)), ///
xlabel(1850(25)1950 1969) scheme(s2mono) graphregion(fcolor(white)) ///
legend(order(1 "France" 2 "Algeria" 3 "Madagascar")) ///
xtitle("") title("") ytitle("Revenue per capita",size(medlarge)) name(panelb, replace) nodraw ///
title("B. French Empire")
graph combine panela panelb, cols(1) xsize(1) ysize(1.5) graphregion(color(white))
graph2tex, epsfile(figurea3)


******************************************
***Figure A.4: Revenue Trends in Silver***
******************************************
use dataset.dta, clear
gen west=0
replace west=1 if ht_region==5
replace west=. if cname=="Japan"
egen pcrev_west_silver=mean(pcrev_silver), by(west year)
replace sample_region=0 if cname=="United States"
replace sample_region=0 if cname=="Japan"
sort ccode year
graph twoway (line pcrev_west_silver year if west==1 & sample_region==1 & year>=1850 & year<=1969, lcolor(black) lpattern(solid)) ///
(line pcrev_west_silver year if west==0 & sample_region==1 & year>=1850 & year<=1969, lcolor(black) lpattern(dash)), ///
xlabel(1850(25)1950 1969) scheme(s2mono) graphregion(fcolor(white)) ///
legend(order(1 "West" 2 "Non-Western")) ///
ytitle("Revenue per capita in silver grams",size(medlarge)) xtitle("")
graph2tex, epsfile(figurea4)


******************************************************************
***Table A.1: The Great Revenue Divergence: Regression Evidence***
******************************************************************
use dataset.dta, clear
tsset ccodecow year
gen west=0
replace west=1 if ht_region==5
gen post1914=0
replace post1914=1 if year>=1914
gen treatment=0
replace treatment=west*post1914
*Table
reg logrev L.logrev i.west##i.post1914 if year<=1969, cluster(ccodecow)
outreg2 using tablea1, replace label nocon
xtreg logrev L.logrev treatment i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tablea1, append label nocon drop(i.year)
reg centaxgdp L.centaxgdp i.west##i.post1914 if year<=1969, cluster(ccodecow)
outreg2 using tablea1, append label nocon
xtreg centaxgdp L.centaxgdp treatment i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tablea1, append label nocon drop(i.year) tex(frag)
*Marginal effect estimates
quietly reg logrev L.logrev i.west##i.post1914 if year<=1969, cluster(ccodecow)
margins, dydx(west) at(post1914=(0 1)) atmeans
quietly reg centaxgdp L.centaxgdp i.west##i.post1914 if year<=1969, cluster(ccodecow)
margins, dydx(west) at(post1914=(0 1)) atmeans


*************************************
***Table A.2: Russian Revenue Data***
*************************************
use dataset.dta, clear
summarize pcrev if cname=="Russia" & year>=1820 & year<=1829
summarize pcrev if cname=="Russia" & year>=1850 & year<=1859
summarize pcrev if cname=="Russia" & year>=1880 & year<=1889
summarize pcrev if cname=="Russia" & year>=1900 & year<=1909
summarize pcrev if cname=="Russia" & year>=1910 & year<1914


**************************************************************
***Table A.3: Wars and Mobilization in the British Military***
**************************************************************
use OSS_mobil_repl_data.dta, clear
keep if country=="United Kingdom"
gen imperial_war=0 if year>=1816 & year<=1913
replace imperial_war=1 if year>=1816 & year<=1816
replace imperial_war=1 if year>=1823 & year<=1826
replace imperial_war=1 if year>=1824 & year<=1826
replace imperial_war=1 if year>=1838 & year<=1838
replace imperial_war=1 if year>=1839 & year<=1842
replace imperial_war=1 if year>=1839 & year<=1842
replace imperial_war=1 if year>=1843 & year<=1843
replace imperial_war=1 if year>=1843 & year<=1843
replace imperial_war=1 if year>=1845 & year<=1846
replace imperial_war=1 if year>=1846 & year<=1847
replace imperial_war=1 if year>=1848 & year<=1849
replace imperial_war=1 if year>=1849 & year<=1849
replace imperial_war=1 if year>=1852 & year<=1852
replace imperial_war=1 if year>=1856 & year<=1860
replace imperial_war=1 if year>=1864 & year<=1864
replace imperial_war=1 if year>=1863 & year<=1863
replace imperial_war=1 if year>=1865 & year<=1865
replace imperial_war=1 if year>=1867 & year<=1868
replace imperial_war=1 if year>=1873 & year<=1874
replace imperial_war=1 if year>=1878 & year<=1879
replace imperial_war=1 if year>=1879 & year<=1879
replace imperial_war=1 if year>=1885 & year<=1889
replace imperial_war=1 if year>=1893 & year<=1894
replace imperial_war=1 if year>=1895 & year<=1896
replace imperial_war=1 if year>=1896 & year<=1899
replace imperial_war=1 if year>=1897 & year<=1897
replace imperial_war=1 if year>=1899 & year<=1902
replace imperial_war=1 if year>=1900 & year<=1900
replace imperial_war=1 if year>=1903 & year<=1903
replace imperial_war=1 if year>=1904 & year<=1904
gen colonial_war=0 if year>=1816 & year<=1913
replace colonial_war=1 if year>=1817 & year<=1818
replace colonial_war=1 if year>=1817 & year<=1818
replace colonial_war=1 if year>=1825 & year<=1826
replace colonial_war=1 if year>=1850 & year<=1852
replace colonial_war=1 if year>=1855 & year<=1856
replace colonial_war=1 if year>=1857 & year<=1859
replace colonial_war=1 if year>=1863 & year<=1866
replace colonial_war=1 if year>=1877 & year<=1878
replace colonial_war=1 if year>=1880 & year<=1881
replace colonial_war=1 if year>=1880 & year<=1881
replace colonial_war=1 if year>=1881 & year<=1885
replace colonial_war=1 if year>=1897 & year<=1898
replace colonial_war=1 if year>=1898 & year<=1898
replace colonial_war=1 if year>=1901 & year<=1904
replace colonial_war=1 if year>=1906 & year<=1906
replace colonial_war=1 if year>=1906 & year<=1906
gen anycolonial_war=.
replace anycolonial_war=1 if colonial_war+imperial_war>=1 & colonial_war!=.
replace anycolonial_war=0 if colonial_war+imperial_war==0
tsset countryno year
reg mobil waryear L.mobil if year>=1689 & year<=1913
outreg2 using tablea3, replace label nocon
reg mobil waryear L.mobil if year>=1816 & year<=1913
outreg2 using tablea3, append label nocon
reg mobil anycolonial_war L.mobil
outreg2 using tablea3, append label nocon
reg mobil anycolonial_war waryear L.mobil
outreg2 using tablea3, append label nocon tex(frag)


******************************************************************************
***Table B.1: Interacting War Participation with Civil Registration Systems***
******************************************************************************
use dataset.dta, clear
tsset ccodecow year
xtreg logrev L.logrev i.L.colwar##c.regstock i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tableb1, replace label nocon drop(i.year)
xtreg logrev L.logrev i.L.colwar##c.regstock L.logpop L.independent i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tableb1, append label nocon drop(i.year)
xtreg logrev L.logrev i.L.colwar##c.regstock2 i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tableb1, append label nocon drop(i.year)
xtreg logrev L.logrev i.L.colwar##c.regstock2 L.logpop L.independent i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tableb1, append label nocon drop(i.year) tex(frag)

*Check for stationarity
reg logrev i.ccodecow i.year if year<=1969
predict residuals, resid
xtunitroot fisher residuals if year<=1969, dfuller lag(1)
drop residuals

*Substantive magnitude
use dataset.dta, clear
tsset ccodecow year
gen west=0
replace west=1 if ht_region==5
summarize regstock if west==1 & year==1946
summarize logrev if west==1 & year==1946
gen L_colwar=L.colwar
gen L_logrev=L.logrev
xtreg logrev L_logrev i.L_colwar##c.regstock i.year if year<=1969, fe cluster(ccodecow)
margins, at(L_colwar=(0 1) regstock=(0 1.284444) L_logrev=4.493844) atmeans


*****************************************************
***Figure B.1: Cross-Section of Interactive Effect***
*****************************************************
use dataset.dta, clear
sort ccode year
egen colwar_stock_wwi=sum(colwar) if year>1913 & year<=1969, by(ccodecow)
gen early_reg=0
replace early_reg=1 if civreg_onset<1900 & civreg_onset!=.
graph twoway (scatter logrev colwar_stock_wwi if year==1969 & early_reg==0, mlabel(cname) mcolor(gray) mlabcolor(gray)) ///
(scatter logrev colwar_stock_wwi if year==1969 & early_reg==1, mlabel(cname) mcolor(black) mlabcolor(black)) ///
(lfit logrev colwar_stock_wwi if year==1969 & early_reg==1, lcolor(black)) ///
(lfit logrev colwar_stock_wwi if year==1969 & early_reg==0, lcolor(gray)), ///
legend(off) xtitle("Cumulative years of war participation, 1914-1969",size(medlarge)) ///
ytitle("Revenue per capita in 1969",size(medlarge)) graphregion(margin(r=12) color(white))
graph2tex, epsfile(figureb1)

reg logrev c.colwar_stock_wwi##i.early_reg if year==1969


************************************************
***Figure B.2: Revenue Trends in WWI Neutrals***
************************************************
use dataset.dta, clear
sort ccode year
graph twoway (line pcrev year if cname=="Denmark" & year>=1870 & year<=1940, lcolor(black) lpattern(solid)) ///
(line pcrev year if cname=="Netherlands" & year>=1870 & year<=1940, lcolor(black) lpattern(dash)) ///
(line pcrev year if cname=="Norway" & year>=1870 & year<=1940, lcolor(blue) lpattern(solid)) ///
(line pcrev year if cname=="Sweden" & year>=1870 & year<=1940, lcolor(blue) lpattern(dash)) ///
(line pcrev year if cname=="Switzerland" & year>=1870 & year<=1940, lcolor(gray) lpattern(solid)), ///
xlabel(1870(10)1940) scheme(s2mono) graphregion(fcolor(white)) ///
legend(order(1 "Denmark" 2 "Netherlands" 3 "Norway" 4 "Sweden" 5 "Switzerland")) ///
ytitle("Revenue per capita",size(medlarge)) xtitle("") title("")
graph2tex,  epsfile(figureb2)


*************************************
***Table B.2: Alternative Measures***
*************************************
use dataset.dta, clear
tsset ccodecow year
*Reg system rather than stock
xtreg logrev L.logrev i.L.colwar##i.L.reg_system i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tableb2, replace label nocon drop(i.year)
xtreg logrev L.logrev i.L.colwar##i.L.reg_system L.logpop L.independent i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tableb2, append label nocon drop(i.year)
*Exclude colonies as world war participants
xtreg logrev L.logrev i.L.wartype##c.regstock i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tableb2, append label nocon drop(i.year)
xtreg logrev L.logrev i.L.wartype##c.regstock L.logpop L.independent i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tableb2, append label nocon drop(i.year) tex(frag)


**************************
***Table B.3: Taxes/GDP***
**************************
use dataset.dta, clear
tsset ccodecow year
*Main
xtreg centaxgdp L.centaxgdp i.L.colwar##c.regstock i.year if year<=1969 , fe cluster(ccodecow)
outreg2 using tableb3, replace label nocon drop(i.year)
xtreg centaxgdp L.centaxgdp i.L.colwar##c.regstock L.logpop L.independent i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tableb3, append label nocon drop(i.year)
*Reg system rather than stock
xtreg centaxgdp L.centaxgdp i.L.colwar##i.L.reg_system i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tableb3, append label nocon drop(i.year)
xtreg centaxgdp L.centaxgdp i.L.colwar##i.L.reg_system L.logpop L.independent i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tableb3, append label nocon drop(i.year)
*Exclude colonies as world war participants
xtreg centaxgdp L.centaxgdp i.L.wartype##c.regstock i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tableb3, append label nocon drop(i.year)
xtreg centaxgdp L.centaxgdp i.L.wartype##c.regstock L.logpop L.independent i.year if year<=1969, fe cluster(ccodecow)
outreg2 using tableb3, append label nocon drop(i.year) tex(frag)
